```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Java异常处理指南 | Spring常见问题解决方案</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background-color: #f8fafc;
            color: #1e293b;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
        }
        .card-hover:hover {
            transform: translateY(-4px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .code-block {
            font-family: 'Courier New', Courier, monospace;
            background-color: #1e293b;
            color: #f8fafc;
        }
        .drop-cap:first-letter {
            float: left;
            font-size: 3.5em;
            line-height: 0.8;
            margin: 0.1em 0.1em 0.1em 0;
            font-weight: 700;
            color: #6366f1;
        }
    </style>
</head>
<body class="antialiased">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-4 md:px-0">
        <div class="container mx-auto max-w-4xl">
            <div class="flex flex-col items-center text-center">
                <div class="w-16 h-16 rounded-full bg-white bg-opacity-20 flex items-center justify-center mb-6">
                    <i class="fas fa-bug text-2xl"></i>
                </div>
                <h1 class="text-4xl md:text-5xl font-bold mb-4 font-serif">Java异常处理指南</h1>
                <p class="text-xl md:text-2xl mb-8 max-w-2xl leading-relaxed">Spring框架常见问题与解决方案精要</p>
                <div class="w-full max-w-3xl bg-white bg-opacity-20 rounded-lg p-6 backdrop-filter backdrop-blur-sm">
                    <p class="text-lg md:text-xl leading-relaxed">
                        <span class="drop-cap">在</span>Spring应用开发中，Bean管理和依赖注入是核心功能，但也是异常频发的区域。本指南系统整理了最常见的四类异常场景，从问题定位到解决方案，帮助开发者快速排查和预防这些问题。
                    </p>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto max-w-6xl px-4 py-12">
        <!-- Problem Grid -->
        <div class="grid grid-cols-1 md:grid-cols-2 gap-8 mb-16">
            <!-- Problem 1 -->
            <div class="bg-white rounded-xl shadow-lg overflow-hidden card-hover transition-all duration-300">
                <div class="p-6 border-b border-gray-200 bg-gradient-to-r from-purple-50 to-indigo-50">
                    <div class="flex items-center mb-4">
                        <div class="w-10 h-10 rounded-full bg-red-500 text-white flex items-center justify-center mr-4">
                            <i class="fas fa-times"></i>
                        </div>
                        <h2 class="text-2xl font-bold text-gray-800">Bean注入失败</h2>
                    </div>
                    <p class="text-gray-600 mb-6">IOC容器中找不到匹配的Bean导致的注入失败问题</p>
                </div>
                <div class="p-6">
                    <div class="mb-6">
                        <h3 class="text-lg font-semibold text-gray-800 mb-3 flex items-center">
                            <i class="fas fa-image text-indigo-500 mr-2"></i>异常截图
                        </h3>
                        <img src="https://cdn.nlark.com/yuque/0/2021/png/21449790/1631515135380-9fcc1691-5c32-43a0-9c06-d6beb7135001.png" 
                             alt="Bean注入失败异常截图" class="rounded-lg border border-gray-200 w-full">
                    </div>
                    <div class="mb-6">
                        <h3 class="text-lg font-semibold text-gray-800 mb-3 flex items-center">
                            <i class="fas fa-search text-indigo-500 mr-2"></i>根本原因
                        </h3>
                        <ul class="space-y-2 pl-5">
                            <li class="flex items-start">
                                <i class="fas fa-circle text-xs text-indigo-500 mt-2 mr-2"></i>
                                <span>IOC容器中没有匹配的bean</span>
                            </li>
                        </ul>
                    </div>
                    <div>
                        <h3 class="text-lg font-semibold text-gray-800 mb-3 flex items-center">
                            <i class="fas fa-tools text-indigo-500 mr-2"></i>解决方案
                        </h3>
                        <ul class="space-y-2 pl-5">
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span>检查和注入相关的bean是否给IOC容器管理</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span>确认是否开启了包扫描</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span>检查类上面是否添加了Controller注解</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span>确认是否为Mapper创建了代理</span>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>

            <!-- Problem 2 -->
            <div class="bg-white rounded-xl shadow-lg overflow-hidden card-hover transition-all duration-300">
                <div class="p-6 border-b border-gray-200 bg-gradient-to-r from-purple-50 to-indigo-50">
                    <div class="flex items-center mb-4">
                        <div class="w-10 h-10 rounded-full bg-yellow-500 text-white flex items-center justify-center mr-4">
                            <i class="fas fa-exclamation"></i>
                        </div>
                        <h2 class="text-2xl font-bold text-gray-800">找到了多个匹配的bean</h2>
                    </div>
                    <p class="text-gray-600 mb-6">IOC容器中存在多个同类型Bean导致的注入冲突</p>
                </div>
                <div class="p-6">
                    <div class="mb-6">
                        <h3 class="text-lg font-semibold text-gray-800 mb-3 flex items-center">
                            <i class="fas fa-image text-indigo-500 mr-2"></i>异常截图
                        </h3>
                        <img src="https://cdn.nlark.com/yuque/0/2021/png/21449790/1631519042210-26a39141-7229-47dc-9739-82c735a3b8a3.png" 
                             alt="多Bean匹配异常截图" class="rounded-lg border border-gray-200 w-full">
                    </div>
                    <div class="mb-6">
                        <h3 class="text-lg font-semibold text-gray-800 mb-3 flex items-center">
                            <i class="fas fa-search text-indigo-500 mr-2"></i>根本原因
                        </h3>
                        <ul class="space-y-2 pl-5">
                            <li class="flex items-start">
                                <i class="fas fa-circle text-xs text-indigo-500 mt-2 mr-2"></i>
                                <span>按照类型注入时IOC容器中存在两个匹配的bean</span>
                            </li>
                        </ul>
                    </div>
                    <div>
                        <h3 class="text-lg font-semibold text-gray-800 mb-3 flex items-center">
                            <i class="fas fa-tools text-indigo-500 mr-2"></i>解决方案
                        </h3>
                        <ul class="space-y-2 pl-5">
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span>使用@Qualifier注解按照名字注入特定bean</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span>使用@Primary注解标记主要bean</span>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>

            <!-- Problem 3 -->
            <div class="bg-white rounded-xl shadow-lg overflow-hidden card-hover transition-all duration-300">
                <div class="p-6 border-b border-gray-200 bg-gradient-to-r from-purple-50 to-indigo-50">
                    <div class="flex items-center mb-4">
                        <div class="w-10 h-10 rounded-full bg-blue-500 text-white flex items-center justify-center mr-4">
                            <i class="fas fa-question"></i>
                        </div>
                        <h2 class="text-2xl font-bold text-gray-800">类找不到异常</h2>
                    </div>
                    <p class="text-gray-600 mb-6">ClassNotFoundException和NoClassDefFoundError问题分析</p>
                </div>
                <div class="p-6">
                    <div class="mb-6">
                        <h3 class="text-lg font-semibold text-gray-800 mb-3 flex items-center">
                            <i class="fas fa-image text-indigo-500 mr-2"></i>异常截图
                        </h3>
                        <div class="space-y-4">
                            <img src="https://cdn.nlark.com/yuque/0/2021/png/21449790/1631521659648-c2ed7064-10c7-4483-9988-4f972b104062.png" 
                                 alt="类找不到异常截图" class="rounded-lg border border-gray-200 w-full">
                            <img src="https://cdn.nlark.com/yuque/0/2021/png/21449790/1631521835785-ca350e31-d04f-45f9-a157-9f27440a5c22.png" 
                                 alt="依赖冲突截图" class="rounded-lg border border-gray-200 w-full">
                        </div>
                    </div>
                    <div class="mb-6">
                        <h3 class="text-lg font-semibold text-gray-800 mb-3 flex items-center">
                            <i class="fas fa-search text-indigo-500 mr-2"></i>根本原因
                        </h3>
                        <ul class="space-y-2 pl-5">
                            <li class="flex items-start">
                                <i class="fas fa-circle text-xs text-indigo-500 mt-2 mr-2"></i>
                                <span>指定的类在classpath路径找不到</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-circle text-xs text-indigo-500 mt-2 mr-2"></i>
                                <span>可能没有导入类所在的依赖包</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-circle text-xs text-indigo-500 mt-2 mr-2"></i>
                                <span>可能存在多个版本的依赖冲突</span>
                            </li>
                        </ul>
                    </div>
                    <div>
                        <h3 class="text-lg font-semibold text-gray-800 mb-3 flex items-center">
                            <i class="fas fa-tools text-indigo-500 mr-2"></i>解决方案
                        </h3>
                        <ul class="space-y-2 pl-5">
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span>如果没有导入依赖，添加对应的依赖包</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span>如果存在依赖冲突，排除低版本依赖</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span>使用mvn dependency:tree检查依赖关系</span>
                            </li>
                        </ul>
                        <img src="https://cdn.nlark.com/yuque/0/2021/png/21449790/1631522273604-005de1a7-7a4e-44ab-a140-8e00264855d4.png" 
                             alt="依赖解决截图" class="mt-4 rounded-lg border border-gray-200 w-full">
                    </div>
                </div>
            </div>

            <!-- Problem 4 -->
            <div class="bg-white rounded-xl shadow-lg overflow-hidden card-hover transition-all duration-300">
                <div class="p-6 border-b border-gray-200 bg-gradient-to-r from-purple-50 to-indigo-50">
                    <div class="flex items-center mb-4">
                        <div class="w-10 h-10 rounded-full bg-orange-500 text-white flex items-center justify-center mr-4">
                            <i class="fas fa-exclamation-triangle"></i>
                        </div>
                        <h2 class="text-2xl font-bold text-gray-800">参数异常</h2>
                    </div>
                    <p class="text-gray-600 mb-6">方法调用时参数不匹配导致的异常</p>
                </div>
                <div class="p-6">
                    <div class="mb-6">
                        <h3 class="text-lg font-semibold text-gray-800 mb-3 flex items-center">
                            <i class="fas fa-image text-indigo-500 mr-2"></i>异常截图
                        </h3>
                        <img src="https://cdn.nlark.com/yuque/0/2021/png/21449790/1631774269370-dd30f687-ced1-41d5-9b59-a171aafcac84.png" 
                             alt="参数异常截图" class="rounded-lg border border-gray-200 w-full">
                    </div>
                    <div class="mb-6">
                        <h3 class="text-lg font-semibold text-gray-800 mb-3 flex items-center">
                            <i class="fas fa-search text-indigo-500 mr-2"></i>根本原因
                        </h3>
                        <ul class="space-y-2 pl-5">
                            <li class="flex items-start">
                                <i class="fas fa-circle text-xs text-indigo-500 mt-2 mr-2"></i>
                                <span>调用方法时传递的参数不正确</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-circle text-xs text-indigo-500 mt-2 mr-2"></i>
                                <span>参数类型不匹配或参数数量不对</span>
                            </li>
                        </ul>
                    </div>
                    <div>
                        <h3 class="text-lg font-semibold text-gray-800 mb-3 flex items-center">
                            <i class="fas fa-tools text-indigo-500 mr-2"></i>解决方案
                        </h3>
                        <ul class="space-y-2 pl-5">
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span>检查方法签名，确认参数类型和数量</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span>使用IDE的自动补全功能确保参数正确</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-green-500 mt-1 mr-2"></i>
                                <span>对于复杂参数，使用DTO对象封装</span>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>

        <!-- Mermaid Diagram -->
        <div class="bg-white rounded-xl shadow-lg p-6 mb-12">
            <h2 class="text-2xl font-bold text-gray-800 mb-6 flex items-center">
                <i class="fas fa-project-diagram text-indigo-500 mr-3"></i>
                Spring异常处理流程图
            </h2>
            <div class="mermaid">
                graph TD
                    A[遇到异常] --> B{异常类型}
                    B -->|Bean注入失败| C[检查IOC容器中是否有匹配Bean]
                    B -->|多个匹配Bean| D[使用@Qualifier或@Primary指定]
                    B -->|类找不到| E[检查依赖和classpath]
                    B -->|参数异常| F[检查方法参数匹配]
                    C --> G[检查包扫描和注解]
                    D --> H[确保Bean命名唯一]
                    E --> I[添加依赖或解决冲突]
                    F --> J[修改调用参数]
                    G --> K[问题解决]
                    H --> K
                    I --> K
                    J --> K
            </div>
        </div>

        <!-- Prevention Section -->
        <div class="bg-gradient-to-r from-indigo-50 to-purple-50 rounded-xl shadow-lg p-8">
            <h2 class="text-2xl font-bold text-gray-800 mb-6 flex items-center">
                <i class="fas fa-shield-alt text-indigo-500 mr-3"></i>
                异常预防最佳实践
            </h2>
            <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
                <div class="bg-white rounded-lg p-6 shadow-sm">
                    <div class="w-12 h-12 rounded-full bg-indigo-100 text-indigo-600 flex items-center justify-center mb-4">
                        <i class="fas fa-check-double text-xl"></i>
                    </div>
                    <h3 class="text-lg font-semibold mb-3">代码审查</h3>
                    <p class="text-gray-600">实施严格的代码审查流程，特别注意依赖注入和Bean配置，提前发现潜在问题。</p>
                </div>
                <div class="bg-white rounded-lg p-6 shadow-sm">
                    <div class="w-12 h-12 rounded-full bg-indigo-100 text-indigo-600 flex items-center justify-center mb-4">
                        <i class="fas fa-vial text-xl"></i>
                    </div>
                    <h3 class="text-lg font-semibold mb-3">单元测试</h3>
                    <p class="text-gray-600">为关键组件编写全面的单元测试，特别是依赖注入点和配置类，确保各种场景下行为正确。</p>
                </div>
                <div class="bg-white rounded-lg p-6 shadow-sm">
                    <div class="w-12 h-12 rounded-full bg-indigo-100 text-indigo-600 flex items-center justify-center mb-4">
                        <i class="fas fa-book text-xl"></i>
                    </div>
                    <h3 class="text-lg font-semibold mb-3">文档记录</h3>
                    <p class="text-gray-600">维护清晰的文档记录常见问题解决方案，建立团队知识库，缩短故障排除时间。</p>
                </div>
            </div>
        </div>
    </main>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
    </script>
</body>
</html>
```